Work around g_test_dbus annoyance
authorMatthias Clasen <mclasen@redhat.com>
Fri, 20 Nov 2015 00:56:19 +0000 (19:56 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 20 Nov 2015 05:13:20 +0000 (00:13 -0500)
Without iterating a mainloop for a bit, g_test_dbus_down() will
give us an error.

testsuite/gtk/defaultvalue.c

index 29254595d62c6b70acc9c11bbf21ed1f51ab8600..557cdd48f9a9da5c69e03482773937140818c31a 100644 (file)
@@ -411,6 +411,7 @@ main (int argc, char **argv)
   guint i;
   gchar *schema_dir;
   GTestDBus *bus;
+  GMainLoop *loop;
   gint result;
 
   /* These must be set before before gtk_test_init */
@@ -446,6 +447,14 @@ main (int argc, char **argv)
 
   result = g_test_run();
 
+  /* Work around the annoying issue that g_test_dbus_down is giving
+   * us an "Error while sending AddMatch" that comes out of an idle
+   */
+  loop = g_main_loop_new (NULL, FALSE);
+  g_timeout_add (1000, (GSourceFunc)g_main_loop_quit, loop);
+  g_main_loop_run (loop);
+  g_main_loop_unref (loop);
+
   g_test_dbus_down (bus);
   g_object_unref (bus);
   g_free (schema_dir);